#include "nodespecs.h"
#include "ui_nodespecs.h"

nodeSpecs::nodeSpecs(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::nodeSpecs)
{
    ui->setupUi(this);
    connect(ui->checkBox_options,SIGNAL(toggled(bool)),this,SIGNAL(options_plugin_toggled(bool)));
    connect(ui->checkBox_editor,SIGNAL(toggled(bool)),this,SIGNAL(editor_plugin_toggled(bool)));
    connect(ui->checkBox_radar,SIGNAL(toggled(bool)),this,SIGNAL(radar_plugin_toggled(bool)));
    connect(ui->checkBox_logo,SIGNAL(toggled(bool)),this,SIGNAL(logo_toggled(bool)));
    connect(ui->checkBox_autorotate,SIGNAL(toggled(bool)),this,SIGNAL(autorotate_toggled(bool)));
    connect(ui->horizontalScrollBar,SIGNAL(valueChanged(int)),this,SIGNAL(panAngleChanged(int)));
    connect(ui->verticalScrollBar,SIGNAL(valueChanged(int)),this,SIGNAL(tiltAngleChanged(int)));
}

nodeSpecs::~nodeSpecs()
{
    delete ui;
}


void nodeSpecs::setBackgroundImage(QImage img){
    ui->label->setPixmap(QPixmap::fromImage(img.scaledToWidth(360)));
}

void nodeSpecs::on_horizontalScrollBar_valueChanged(int value)
{
    int x = 180 + value;
    ui->pan_line->setGeometry(x,0,3,180);
}

void nodeSpecs::on_verticalScrollBar_valueChanged(int value)
{
    int y = 90 + value;
    ui->tilt_line->setGeometry(0,y,360,3);
}

void nodeSpecs::on_options_toggled(bool val){
    ui->checkBox_options->setChecked(val);
}

void nodeSpecs::on_editor_toggled(bool val){
    ui->checkBox_editor->setChecked(val);
}

void nodeSpecs::on_radar_toggled(bool val){
    ui->checkBox_radar->setChecked(val);
}

void nodeSpecs::on_logo_toggled(bool val){
    ui->checkBox_logo->setChecked(val);
}

void nodeSpecs::on_autorotate_toggled(bool val){
    ui->checkBox_autorotate->setChecked(val);;
}
